
#include "WelcomeLayer.h"
#include "SceneManager.h"

WelcomeLayer::WelcomeLayer()
{


}

WelcomeLayer::~WelcomeLayer()
{

}

bool WelcomeLayer::init()
{
	bool bRet=false;
	do 
	{
		CC_BREAK_IF(!CCLayer::init());

		CCSize winSize=CCDirector::sharedDirector()->getWinSize();

		CCMenuItemFont *i=CCMenuItemFont::create("new game",this,menu_selector(WelcomeLayer::BeginGame));
		i->setPosition(ccp(winSize.width/2,winSize.height/2));

		CCMenu* pMenu =CCMenu::create(i,NULL);
		pMenu->setPosition(CCPointZero);
		this->addChild(pMenu);

		this->scheduleUpdate();
		bRet=true;
	} while (0);
	return bRet;
}

void WelcomeLayer::BeginGame(CCObject* pSender)
{
	SceneManager::sharedSceneManager()->changeScene(SceneManager::en_GameScene);
}